* A new specialpage to list pages not watched by anyone
[lhc/web/wiklou.git] / includes / SpecialUnwatchedpages.php
1 <?php
2 /**
3 * A special page that displays a list of pages that are not on anyones watchlist
4 *
5 * @package MediaWiki
6 * @subpackage SpecialPage
7 *
8 * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
9 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
10 */
11
12 /* */
13 require_once 'QueryPage.php';
14
15 /**
16 * @package MediaWiki
17 * @subpackage SpecialPage
18 */
19 class UnwatchedpagesPage extends QueryPage {
20
21 function getName() { return 'Unwatchedpages'; }
22 function isExpensive() { return true; }
23 function isSyndicated() { return false; }
24
25 function getSQL() {
26 $dbr =& wfGetDB( DB_SLAVE );
27 extract( $dbr->tableNames( 'page', 'watchlist' ) );
28 return
29 "
30 SELECT
31 'Unwatchedpages' as type,
32 page_namespace as namespace,
33 page_title as title,
34 page_namespace as value
35 FROM $page
36 LEFT JOIN $watchlist ON wl_namespace = page_namespace AND page_title = wl_title
37 WHERE wl_title IS NULL
38 ";
39 }
40
41 function sortDescending() { return false; }
42
43 function formatResult( $skin, $result ) {
44 global $wgContLang;
45
46 $nt = Title::makeTitle( $result->namespace, $result->title );
47 $text = $wgContLang->convert( $nt->getPrefixedText() );
48
49 $plink = $skin->makeKnownLink( $nt->getPrefixedText(), htmlspecialchars( $text ) );
50
51 return $plink;
52 }
53 }
54
55 /**
56 * constructor
57 */
58 function wfSpecialUnwatchedpages() {
59 list( $limit, $offset ) = wfCheckLimits();
60
61 $wpp = new UnwatchedpagesPage();
62
63 $wpp->doQuery( $offset, $limit );
64 }
65
66 ?>